package com.itheima.controller;

import com.itheima.common.R;
import com.itheima.service.EmpService;
import com.itheima.service.StudentService;
import com.itheima.vo.ClazzCountVo;
import com.itheima.vo.EmpJobVo;
import com.itheima.vo.ItemVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 报表统计模块
 */
@Slf4j
@RequestMapping("/report")
@RestController
public class ReportController {

    @Autowired
    private EmpService empService;
    @Autowired
    private StudentService studentService;

    /**
     * 员工性别统计
     *
     * @return
     */
    @GetMapping("/empGenderData")
    public R getEmpGenderData() {
        log.info("员工性别统计");
        List<ItemVo> list = empService.getEmpGenderData();
        return R.ok(list);
    }

    /**
     * 员工职位统计
     *
     * @return
     */
    @GetMapping("/empJobData")
    public R getEmpJobData() {
        log.info("员工职位统计");
        EmpJobVo vo = empService.getEmpJobData();
        return R.ok(vo);
    }

    /**
     * 统计学员的学历信息
     */
    @GetMapping("/studentDegreeData")
    public R getStudentDegreeData() {
        log.info("统计学员的学历信息");
        List<Map> dataList = studentService.getStudentDegreeData();
        return R.ok(dataList);
    }

    /**
     * 班级人数统计
     */
    @GetMapping("/studentCountData")
    public R getStudentCountData() {
        log.info("班级人数统计");
        ClazzCountVo vo = studentService.getStudentCountData();
        return R.ok(vo);
    }
}
